{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7bcf0f81-aec8-4f49-918c-3163917885ec",
   "metadata": {},
   "outputs": [],
   "source": [
    "indexes = {\n",
    "    \"00-quick-start.ipynb\": \"book_index\",\n",
    "    \"01-keyword-querying-filtering.ipynb\": \"book_index\",\n",
    "    \"02-hybrid-search.ipynb\": \"book_index\",\n",
    "    # 03-ELSER.ipynb has its own teardown notebook\n",
    "    \"04-multilingual.ipynb\": \"articles\",\n",
    "    \"05-query-rules.ipynb\": \"products_index\",\n",
    "    \"06-synonyms-api.ipynb\": \"book_index\",\n",
    "}\n",
    "INDEX_NAME = indexes.get(NBTEST[\"notebook\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fcd17ce3-ece3-4268-b37b-bbf47c2437c8",
   "metadata": {},
   "outputs": [],
   "source": [
    "# get the Elasticsearch client\n",
    "from elasticsearch import Elasticsearch\n",
    "from getpass import getpass\n",
    "\n",
    "ELASTIC_CLOUD_ID = getpass(\"Elastic Cloud ID: \")\n",
    "ELASTIC_API_KEY = getpass(\"Elastic Api Key: \")\n",
    "\n",
    "client = Elasticsearch(\n",
    "    cloud_id=ELASTIC_CLOUD_ID,\n",
    "    api_key=ELASTIC_API_KEY,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "abf51067-61f8-4cf3-b950-464805ea0e8d",
   "metadata": {},
   "outputs": [],
   "source": [
    "# delete the notebook's index\n",
    "if INDEX_NAME:\n",
    "    client.indices.delete(index=INDEX_NAME, ignore_unavailable=True)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
